<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://unpkg.com/vue-router@4"></script> 
</head>
<body>
    <div id ="app">
        <router-link to="/">主页</router-link><br>
        <router-link to="/account/lijiaqi">用户账户</router-link>
        <router-view></router-view>
    </div>
    <script>
        const Home={
            template:`<h2>主页信息</h2>`
        }
        const Account={
            template:`<h2>账户信息</h2>`+
            '<p>用户名:{{$route.params.userName}}</p>'
        }
const router=VueRouter.createRouter({
    history:VueRouter.createWebHashHistory(),
    routes:[
        {
            path:'/',
            component:Home
        },
        {
            path:"/account/:userName",
            name:"account",
            component:Account
        }
    ]
})
    const appObj=Vue.createApp({})
    appObj.use(router)
    appObj.mount("#app")
    </script>
</body>
</html>